<?php
use think\facade\Route;

Route::group('api', function () {
    Route::post('auth/register', 'api/Auth/register');
    Route::post('auth/login', 'api/Auth/login');

    // 测试类型相关（无需登录）
    Route::get('test/types', 'api/TestType/index');

    // 以下接口需要登录（中间件校验token）
    Route::middleware(['api.auth'])->group(function () {
        Route::get('user/info', 'api/User/info');
        Route::get('test/:typeId/questions', 'api/Test/getQuestions');
        Route::post('test/submit', 'api/Test/submitAnswer');
        Route::get('test/records', 'api/Test/getRecords');
    });
});
